﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="user_questionmanage.aspx.cs" Inherits="backmanage_usersystem_user_questionmanage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>密码保护管理</title>
    <script type="text/javascript" src="../js/jquery-1.6.1.js"></script>
	<link rel="stylesheet" href="../css/jquery.ui.all.css" />
	<script type="text/javascript" src="../external/jquery.bgiframe-2.1.2.js"></script> 
	<script type="text/javascript" src="../js/jquery.ui.core.js"></script> 
	<script type="text/javascript" src="../js/jquery.ui.widget.js"></script> 
	<script type="text/javascript" src="../js/jquery.ui.mouse.js"></script> 
	<script type="text/javascript" src="../js/jquery.ui.button.js"></script> 
	<script type="text/javascript" src="../js/jquery.ui.draggable.js"></script> 
	<script type="text/javascript" src="../js/jquery.ui.position.js"></script> 
	<script type="text/javascript" src="../js/jquery.ui.resizable.js"></script> 
	<script type="text/javascript" src="../js/jquery.ui.dialog.js"></script>
	<script type="text/javascript" src="../js/jquery.ui.datepicker.js"></script>
	<script type="text/javascript" src="../js/jquery.effects.core.js"></script>
	<link rel="stylesheet" href="../css/demos.css" />  
	<script type="text/javascript">
	 $(function(){
	       function QuestionDel(i)
	       {
	          $.ajax({
	                  async:false,
	                  url:'../API/A_Userquestion.aspx',
	                  type:'POST',
	                  data:{edit:'del',id:i},
	                  success:function(msg)
	                  {
	                     //alert(msg);
	                     QuestionList();
	                  }
	          });
	       }
	       function QuestionList()
	       {
	          $.ajax({
	                   async:false,
	                   url:'../API/A_Userquestion.aspx',
	                   type:'POST',
	                   data:{edit:'list'},
	                   success:function(msg)
	                   {
	                      $("#questionlist tbody").text("");
	                      $("#questionlist tbody").append(msg);
	                      $("#questionlist a.del").click(function(){
	                                  var i=$(this).attr("title");
	                                  SetWindows(i);
	                                  $("#windows-info").dialog("open");
	                      });
	                   }
	          });
	       }
	       function QuestionAdd()
	       {
	          var question=$("#question").val();
	          $.ajax({
	                  async:false,
	                  url:'../API/A_Userquestion.aspx',
	                  type:'POST',
	                  data:{edit:'add',q:question},
	                  success:function(msg)
	                  {
                          QuestionList();        
	                  }
	          });
	       }
	       
           $("#create-form").dialog("destory");
           $("#windows-info").dialog("destory");
	       $("#create-form").dialog({
                          autoOpen:false,
                          height:130,
                          width:250,
                          modal:true,
                          resizable:false,
                          buttons:{
                                  "确定":function(){
                                       QuestionAdd();
                                       $(this).dialog("close");
                                  },
                                  "取消":function(){
                                       $(this).dialog("close");
                                  },
                          },
               });   
           function SetWindows(i)
           {
           $("#windows-info").dialog({
                          autoOpen:false,
                          height:130,
                          width:230,
                          modal:true,
                          resizable:false,
                          buttons:{
                                  "确定":function(){
                                        QuestionDel(i);
                                        $(this).dialog("close");
                                  },
                                  "取消":function(){
                                       $(this).dialog("close");
                                  },
                          },
               });
           }	            
	       $("#create-user").button().click(function(){
	                  $("#create-form").dialog("open");
	       });
	       $(document).ready(function(){QuestionList();});
	            
	 })
	</script>
    <style type="text/css">
    .create-form{ display:none;}
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    密码保护管理<a id="create-user">添加密保问题</a>
    <table id="questionlist">
      <thead>
         <tr>
            <td>编号</td>
            <td>密码保护问题</td>
            <td>操作</td>
         </tr>
      </thead>
      <tbody>
      </tbody>
      <tfoot>
         <tr>
            <td colspan="3">一共0条 10条/页</td>
         </tr>
      </tfoot>
    </table>
    </div>
    <div id="create-form" class="create-form" title="添加密保问题">
       密码保护问题：<input type="text" id="question" />
    </div>
    <div id="windows-info" class="create-form" title="系统提示">
    <p>确定要删除此条信息？</p>
    </div>
    </form>
</body>
</html>
